﻿<?php
 defined('BASEPATH') or die ('No direct script access allowed');
 
 /*
*
* Sign Controller用于用户登陆,注册,登出控制
* 
* 包含function:
* sign_up
* 
* sign_in
* 
* logout
* 
* @author ivanyun
* @2010-09-01
* 
* */
    class Sign extends Controller {
        function Sign(){
            parent::Controller();
        }
        
        /*
        *
        *@function sign_up
        *@argument none
        *@return none 
        * 用于用户注册,填写表单与处理表单
        * */
        function sign_up(){
        	if($this->input->post()){
        		echo "1";
        		exit();
        		
        	}
        	
        	$this->load->helper('form');
            $this->load->helper('sign_up_form_helper');
            $this->load->library('form_validation');
            $rules['username']    = "required|alpha_dash|min_length[6]";
            $rules['name']   = "required";
            $rules['password']   = "required|alpha_numeric|min_length[6]";
            $rules['password2']   = "required|alpha_numeric|min_length[6]";
            $rules['email']   = "required";
            $this->form_validation->set_rules($rules);
        	if($this->form_validation->run()==true){
        		echo "1";
	        }else{
	            $page_data['form']=sign_up_form_helper();
	            $data['page_view']='sign/sign_up_view';
	            $data['page_data']=$page_data;
	            $this->load->view('layout_view',$data);
	        }
        }
        
        function logout(){
            
        	
        }
        
        function sign_in(){
            
        	
        }
        
        
    }
